/**
 * 	write on 2005-10-29 23:00:28.
 */
package org.nanhill.xmlro.sro.model;

import org.nanhill.xmlro.Serializer;
import org.nanhill.xmlro.XmlroOutput;

/**
 * @author alin
 * 
 */
public class StringArraySerializer implements Serializer {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.protocol.xmlro.Serializer#writeObject(java.lang.Object,
	 *      org.nanhill.protocol.xmlro.Output)
	 */
	public void writeObject(Object obj, XmlroOutput out) {
		String[] data = (String[]) obj;
		out.writeListBegin();
		out.writeListSize(data.length);
		for (int i = 0; i < data.length; i++) {
			String item = data[i];
			if (null == item)
				out.writeNull();
			else
				out.writeString(item);
		}
		out.writeListEnd();
	}

}
